<?php if (!isset($_SESSION)) session_start(); ?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">

<title>Koreanet</title>

<!-- Nanum Webfont -->
<style>
* {
	font-family: 'NanumGothic' !important;
}
</style>
<script src="http://www.google.com/jsapi"></script>
<script>
 google.load( "webfont", "1" );
 google.setOnLoadCallback(function() {
  WebFont.load({ custom: {
   families: [ "NanumGothic" ],
   urls: [ "http://fontface.kr/NanumGothic/css" ]
  }});
 });
</script>

<!-- Bootstrap core CSS -->
<link href="./dist/css/bootstrap.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="./css/daily_report.css" rel="stylesheet">
<link rel="stylesheet"
	href="./lib/datetimepicker/bootstrap-datetimepicker.min.css" />
</head>

<body>
<?php include 'header.php';?>
<?php require_once './class/Evaluation.inc';?>
<?php require_once './class/Evaluation_check.inc';?>
<?php

if ($getType == 1) {
	if ($login == null || $login->getGrade () > 2) {
		echo "<script type='text/javascript'>";
		echo "location.replace('./main.php');";
		echo "</script>";
		exit ();
	}
}

$search_date = $_GET['date1'];

if($search_date == ""){
	$search_date = substr(date('Y/m/d'),0,4);
}

?>
	<div class="container container_bottom">
		<div class="row row_margin">
			<div class="col-md-12">
				<h2>평가수행</h2>
			</div>
		</div>
		<div class="row row_margin">
			<div class="col-md-4">
				<div id="search_date">
					<div class="input-group-wrapper first_wrapper">
						<div class='input-group date' id='picker1'>
							<span class='input-group-addon'>날짜(년도)</span> <select
									class="form-control" id="date1" name="date1"
									onchange="javascript:changeDelemiter(this)">
									
									<?php 
										$eval_date = new Evaluation_check();
										$eval_date -> date_search('3',$login->getSession(),$search_date."/12/31");
										
									?>
								</select>
							</span>
						</div>
					</div>
				</div>
			</div>
		</div>
		<form class="form-signin" role="form"
			<?php
			if ($getType == null || empty ( $getType )) {
				echo "action='./ajax/modify_daily_report.php'";
			} else if ($getType == 1) {
				echo "action='./ajax/create_daily_report.php'";
			}
			?>
			method="post">
			<div class="row row_margin">
				<div class="col-md-12 button_align">
					<div class="row row_margin row_top" style="float:right;">
					    <?php 
					    // 테스트 코드
					    //if ($login->getSession() != '100001') {
					    	$eval_check = new Evaluation_check();
							if($eval_check -> time_check('1',$login->getSession(),date('Y/m/d')) != ""){
					    ?>
						<div class="btn-group">
							<button class="btn btn-lg btn-primary" type="button"
								onclick="location.href='./evaluation_insert.php?timecheck=<?php echo $eval_check->timecheck;?>'"><?php echo substr($eval_check->timecheck,0,7);?>평가입력</button>
						</div>
						<?php 
							}
					    //}
						if($login->getSession() == '100001' || $login->getSession() == '100002'){
						?>
						<div class="btn-group">
							<button class="btn btn-lg btn-success" type="button"
								onclick="location.href='./evaluation_report.php?pageType=1'">평가조회</button>
						</div>
						<?php 
						}
						if($login->getSession() == '100001' || $login->getSession() == '100002'){
						?>
						<div class="btn-group">
							<button class="btn btn-lg btn-success" type="button"
								onclick="location.href='./evaluation_setting.php?pageType=1'">평가설정</button>
						</div>
						<?php } ?>
					</div>
				</div>
				<div class="col-md-12">
					<div class="row row_margin row_top">
						<table class="table table-bordered" id="attendance_table">
							<?php
								if($login->getSession() != '100001'){
									$eval = new Evaluation();
									$eval->search4table_user("1",$search_date."/12/31",$login->getSession());
								}
							?>
						</table>
					</div>
					<div class="row row_margin row_top">
						<table class="table table-bordered" id="attendance_table">
							<?php
								$eval = new Evaluation();
								$eval->search4table_rate("2",$search_date."/12/31",null);
							?>
						</table>
					</div>
				</div>
				<!-- 추가 부분 -->
			</div>
			<!--
			<div class="row row_margin">
				<div class="col-md-12 text-right">
					<button class="btn btn-lg btn-default" type="button"
						onclick="javascript:initData()">저장</button>
				</div>
			</div>
			-->
		</form>
	</div>
	<!-- /container -->

	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
	<script src="./dist/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="./lib/moment/moment.js"></script>
	<script type="text/javascript" src="./lib/moment/transition.js"></script>
	<script type="text/javascript" src="./lib/moment/collapse.js"></script>
	<script type="text/javascript"
		src="./lib/datetimepicker/bootstrap-datetimepicker.min.js"></script>

	<script type="text/javascript">
	$(window).load(function () {

	});

	$(document).ready(function () {
		$('#date1').val(<?php echo $search_date; ?>);
	});
	function changeDelemiter(obj){
		location.href="./evaluation.php?date1="+obj.value;
	}


	
	function initData() {
		
	}
	
	</script>
</body>
</html>